<?php
/*
 * Created on 22.12.2005
 *
 */

class c_paramHandler 
{

    function startElement (& $sender, $attrs)
    {
        $parent = $sender->topParent();
        if ($parent['tag'] != 'url')
            die ("Parent of param must be url!\n");
        if (!$attrs['value'] || !$attrs['name'])
        {
            die ("Attribute name and value are missing at param tag\n");
        }
        if (empty($attrs['encode']) || $attrs['encode'] == "'true'" || (is_bool($attrs['encode']) && $attrs['encode'] == true)) {
            $sender->appendCode('$__'."url->addParam(".$attrs['name'].", urlencode(".$attrs['value']."));\n");        
        } else {
            $sender->appendCode('$__'."url->addParam(".$attrs['name'].", ".$attrs['value'].");\n");
        }        
    }
    
    function endElement (& $sender)
    {
    }

}

?>
